Skip to content

[Yg-cho] WEEK 01 Solutions#1707

Merged
yg-cho merged 6 commits intoDaleStudy:mainfrom
yg-cho:main
Jul 26, 2025
Merged

[Yg-cho] WEEK 01 Solutions#1707
yg-cho merged 6 commits intoDaleStudy:mainfrom
yg-cho:main

Conversation

@yg-cho
Copy link
Copy Markdown
Contributor

@yg-cho yg-cho commented Jul 23, 2025

๋‹ต์•ˆ ์ œ์ถœ ๋ฌธ์ œ

์ž‘์„ฑ์ž ์ฒดํฌ ๋ฆฌ์ŠคํŠธ

  • Projects์˜ ์˜ค๋ฅธ์ชฝ ๋ฒ„ํŠผ(โ–ผ)์„ ๋ˆŒ๋Ÿฌ ํ™•์žฅํ•œ ๋’ค, Week๋ฅผ ํ˜„์žฌ ์ฃผ์ฐจ๋กœ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.
  • ๋ฌธ์ œ๋ฅผ ๋ชจ๋‘ ํ‘ธ์‹œ๋ฉด ํ”„๋กœ์ ํŠธ์—์„œ Status๋ฅผ In Review๋กœ ์„ค์ •ํ•ด์ฃผ์„ธ์š”.
  • ์ฝ”๋“œ ๊ฒ€ํ† ์ž 1๋ถ„ ์ด์ƒ์œผ๋กœ๋ถ€ํ„ฐ ์Šน์ธ์„ ๋ฐ›์œผ์…จ๋‹ค๋ฉด PR์„ ๋ณ‘ํ•ฉํ•ด์ฃผ์„ธ์š”.

๊ฒ€ํ† ์ž ์ฒดํฌ ๋ฆฌ์ŠคํŠธ

Important

๋ณธ์ธ ๋‹ต์•ˆ ์ œ์ถœ ๋ฟ๋งŒ ์•„๋‹ˆ๋ผ ๋‹ค๋ฅธ ๋ถ„ PR ํ•˜๋‚˜ ์ด์ƒ์„ ๋ฐ˜๋“œ์‹œ ๊ฒ€ํ† ๋ฅผ ํ•ด์ฃผ์…”์•ผ ํ•ฉ๋‹ˆ๋‹ค!

  • ๋ฐ”๋กœ ์ด์ „์— ์˜ฌ๋ผ์˜จ PR์— ๋ณธ์ธ์„ ์ฝ”๋“œ ๋ฆฌ๋ทฐ์–ด๋กœ ์ถ”๊ฐ€ํ•ด์ฃผ์„ธ์š”.
  • ๋ณธ์ธ์ด ๊ฒ€ํ† ํ•ด์•ผํ•˜๋Š” PR์˜ ๋‹ต์•ˆ ์ฝ”๋“œ์— ํ”ผ๋“œ๋ฐฑ์„ ์ฃผ์„ธ์š”.
  • ํ† ์š”์ผ ์ „๊นŒ์ง€ PR์„ ๋ณ‘ํ•ฉํ•  ์ˆ˜ ์žˆ๋„๋ก ์Šน์ธํ•ด์ฃผ์„ธ์š”.

@chrisjune chrisjune self-requested a review July 24, 2025 01:16
Copy link
Copy Markdown
Contributor

@chrisjune chrisjune left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

๊ณ ์ƒํ•˜์…จ์Šต๋‹ˆ๋‹ค
์ฝ”๋ฉ˜ํŠธ๋ฅผ ๋‚จ๊ธฐ์ง€ ์•Š์€ ๋ฌธ์ œ๋Š” ์ €์™€ ํ’€์ด๊ฐ€ ๋„ˆ๋ฌด ์œ ์‚ฌํ•ด์„œ ๋†€๋ž์Šต๋‹ˆ๋‹ค ใ…Žใ…Ž

* @return {boolean}
*/
var containsDuplicate = function(nums) {
return new Set(nums).size !== nums.length;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ „ ๊ฐœ์ˆ˜๋ฅผ ์„ธ์„œ 2๊ฐœ์ด์ƒ์ธ์ง€ ํŒ๋‹จํ–ˆ๋Š”๋ฐ set์„ ์ด์šฉํ•œ๊ฑด ๋˜๊ฒŒ ์ข‹์€ ์•„์ด๋””์–ด๋„ค์š”

let longest = 0;

for (const num of numSet) {
if(!numSet.has(num-1)) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋Š” ์ต์ˆ™์น˜ ์•Š์•„์„œ ์ œ๊ฐ€ ์ œ๋Œ€๋กœ ์ดํ•ดํ•œ์ง„ ์ž˜ ๋ชจ๋ฅด๊ฒ ์Šต๋‹ˆ๋‹ค
์˜๋„๊ฐ€ numSet์„ ์ˆœํšŒํ•˜๋ฉด์„œ ๋” ์ž‘์€๊ฒŒ ์—†๋Š”์ง€ ์ฒดํฌํ•˜๋Š” ์šฉ๋„๋กœ ์“ฐ์‹  if์ ˆ์ด๋ผ๋ฉด
์ˆœํšŒ ์ „์— numSet์„ sortํ•˜๋ฉด if๋ฌธ์„ ์‚ฌ์šฉํ•˜์ง€ ์•Š์•„๋„ ๋ ๊ฒƒ ๊ฐ™์•„์š”. ๊ทผ๋ฐ ์‹œ๊ฐ„๋ณต์žก๋„๋ฅผ ์ƒ๊ฐํ•ด๋ณด๋ฉด if๋ฌธ์ด ๋” ์œ ๋ฆฌํ•  ์ˆ˜ ์žˆ๊ฒ ์–ด์š”!

์ €๋„ ์ฒ˜์Œ์—” ์ค‘์ฒฉ๋ฃจํ”„๋กœ ํ’€์—ˆ๋Š”๋ฐ์š”, dynamic programming์„ ์ด์šฉํ•ด์„œ nums์™€ ๋™์ผํ•œ ํฌ๊ธฐ์˜ ๋ฐฐ์—ด์„ ๋งŒ๋“ค๊ณ 
๋ฐฐ์—ด๊ฐ’์ด ํ˜„์žฌ๊นŒ์ง€์˜ ์ตœ๋Œ€์—ฐ์†๋œ ์ˆซ์ž์˜ ๊ฐœ์ˆ˜๋กœ ์—…๋ฐ์ดํŠธํ•˜๋Š” ๋ฐฉ์‹์œผ๋กœ ํ’€๋ฉด ๋‹จ์ผ๋ฃจํ”„๋กœ๋„ ํ’€ ์ˆ˜ ์žˆ๋”๋ผ๊ณ ์š”

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

์•ˆ๋…•ํ•˜์„ธ์š”.
sort๋ฅผ ํ•˜๊ธฐ ๋ณด๋‹ค, ํ˜„์žฌ ์ˆซ์ž๋ณด๋‹ค ์ž‘์€ num-1์ด ์กด์žฌํ•˜์ง€ ์•Š์œผ๋ฉด ํ˜„์žฌ ์ˆซ์ž๊ฐ€ ์ด์ „ ๋ณด๋‹ค ์ž‘์œผ๋‹ˆ ์‹œ์ž‘์ ์œผ๋กœ ๋ณด๊ณ , ํ•ด๋‹น ๊ฐ’๋ถ€ํ„ฐ ์ฆ๊ฐ€ํ•ด ๋‚˜๊ฐ€๋ฉด์„œ ์—ฐ์†๋œ ํšŸ์ˆ˜๋ฅผ ์ฐพ์•˜์Šต๋‹ˆ๋‹ค.
์–ด๋–ค ์ˆœ์„œ๋กœ ์ˆœํšŒํ•˜๋“  ๋ชจ๋“  ์‹œ์ž‘์ ์„ ๋‹ค ์ฐพ๊ฒŒ ๋˜๊ณ , ์ˆœ์„œ๋Š” ๊ฒฐ๊ณผ์— ์˜ํ–ฅ์ด ์—†๋‹ค๊ณ  ์ƒ๊ฐํ•˜์—ฌ sortํ•˜์ง„ ์•Š์•˜์Šต๋‹ˆ๋‹ค.

๋ฆฌ๋ทฐ ๊ฐ์‚ฌํ•ฉ๋‹ˆ๋‹ค~

@yg-cho yg-cho merged commit 384138b into DaleStudy:main Jul 26, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects

Development

Successfully merging this pull request may close these issues.

2 participants